interface Story {
  id: string;
  title: string;
  content: string;
  imageUrl: string;
  viewCount: number;
  favoriteCount: number;
}

Page({
  data: {
    story: {} as Story
  },

  onLoad(options) {
    if (options.id) {
      this.loadStoryDetail(options.id);
    }
  },

  loadStoryDetail(storyId: string) {
    // 模拟从服务器获取故事详情数据
    const mockStory: Story = {
      id: storyId,
      title: '小红帽',
      content: '从前有一个可爱的小女孩，她总是戴着奶奶送给她的红色帽子，所以大家都叫她小红帽...',
      imageUrl: '/images/story-cover.png',
      viewCount: 1000,
      favoriteCount: 500
    };
    
    this.setData({
      story: mockStory
    });
  }
}))